<?php

namespace Application\Model;

use Application\Model\Entity\Menu;
use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Sql\Select;

class MenuModel extends AbstractTableGateway {
	protected $table = 'menu';

	public function __construct(Adapter $adapter) {
		$this->adapter = $adapter;
	}

	public function fetchAll() {
		$resultSet = $this->select(function (Select $select) {
			$select->order(array(
				'order ASC'
			));
		});
		
		$arr = array();
		foreach($resultSet as $set) {
			$arr[] = new Menu((array) $set);
		}
		return $arr;
	}
}